package com.thunisoft.converter.fop;

import java.util.ArrayList;
import java.util.List;

public class RenderEvent {

    private String methodName;

    private List<Object[]> propList = new ArrayList<Object[]>();

    private List<RenderEvent> childList = new ArrayList<RenderEvent>();

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public List<Object[]> getPropList() {
        return propList;
    }

    public void setPropList(List<Object[]> propList) {
        this.propList = propList;
    }

    public void addProp(Object[] prop) {
        this.propList.add(prop);
    }

    public List<RenderEvent> getChildList() {
        return childList;
    }

    public void setChildList(List<RenderEvent> childList) {
        this.childList = childList;
    }

    public void addChildEvent(RenderEvent event) {
        this.childList.add(event);
    }

    public String getDesc() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.methodName).append(" (");
        for (int i = 0; i < this.propList.size(); i++) {
            if (i != 0) {
                sb.append(", ");
            }
            Object[] pair = this.propList.get(i);
            sb.append(pair[0]).append("=").append(pair[1]);
        }
        sb.append(")");
        return sb.toString();
    }
}
